(function() {
	
	//Array 객체에 remove 확장
	Array.prototype.remove = function() {
		var what, a = arguments, L = a.length, ax;
		while (L && this.length) {
			what = a[--L];
			while ((ax = this.indexOf(what)) !== -1) {
				this.splice(ax, 1);
			}
		}
		return this;
	};
	
	
	if (!window.CJ) {
		window.CJ = {};
	}
	CJ.isDev = true;

	/** @constant
		@type {boolean}
		@description 실행 중인 Browser 가 TV 환경인지 여부
	*/
	CJ.IS_TV = /NetCast/.test(navigator.userAgent);
	/**
	 * @private
	 * @listens event:keydown
	 * @description document 에 할당될 keydown Event 대리자를 갖는 Static 객체
	*/
	CJ.util = {
		numDot : function( n ) {
			var nStr = n.toString();
			nStr += '';
			x = nStr.split('.');
			x1 = x[0];
			x2 = x.length > 1 ? '.' + x[1] : '';
			var rgx = /(\d+)(\d{3})/;
			while (rgx.test(x1)) {
				x1 = x1.replace(rgx, '$1' + ',' + '$2');
			}
			return x1 + x2;
		},
		getDate : function (sdate){
			var ampm = 0;
			var bits = sdate.split(/\D/);
			if (/오후/.test(sdate)) {
				ampm = 12;
			}
			var date = new Date(bits[0], --bits[1], bits[2], bits[6]+ampm, bits[7], bits[8]);
			return date;
		},
		getDateStr : function (sdate, split){
			function pad(n){return n<10 ? '0'+n : n}
			if (isNaN(sdate)) {
				var bits = sdate.split(/\D/);
				var date = new Date(bits[0], --bits[1], bits[2], bits[3], bits[4]);
				return date.getUTCFullYear()+split
						+ pad(date.getUTCMonth()+1)+split
						+ pad(date.getUTCDate());
			} else {
				return sdate.substr(2, 2)+split
						+ sdate.substr(4, 2)+split
						+ sdate.substr(6, 2);
			}
		},
		getDateDay : function (sdate){
			if (isNaN(sdate)) {
				var bits = sdate.split(/\D/);
				var date = new Date(bits[0], --bits[1], bits[2], bits[3], bits[4]);
				return date;
			} else {
				var date = new Date(sdate.substr(0, 4), (parseInt(sdate.substr(4, 2)) - 1), sdate.substr(6, 2));
				return date;
			}
		},
		/*
		LG keyboard 가 focus 처리를 잘 못해줌
		직접 호출
		*/
		lgKbForceShow : function (target) {
			var event = {};
			event.view = window;
			event.target = target;
			lgKb.focusIn(event);
		}
	};
/*	
	var cacheElement = {
		pool:
		get: function (selector) {
		
		}
		function getElements() {
		  if (cachedElements) {
			return cachedElements;
		  }
		  cachedElements = $('.my-class');
		  return cachedElements;
	}
	
	var cachedElements;
function getElements() {
  if (cachedElements) {
    return cachedElements;
  }
  cachedElements = $('.my-class');
  return cachedElements;
}
*/

})();